<?php 

class NewsAction extends BaseAction{


	/**
	 * 首页
	 * @return [type] [description]
	 */
	function index(){
		$cid=intval($_GET['cid']) ? intval($_GET['cid']) : 55; 
		$r = getCatgory(55);
		$content = getContent($cid);
		$this->assign('res',$r);
		$this->assign('cid',$cid);
		$this->assign('con',$content);
		$this->display();		
		
	}

	function detail(){
		$id = I('id');
		$db=M("content");

		$r = getCatgory(55);
		$content = getContent($cid);
		$this->assign('res',$r);

		//$aboutinfo = M("category")->where($map)->order(array("orderid"=>"asc","id"=>"desc"))->find();
		if($r=$db->where(array("id"=>$id,"checkinfo"=>0))->find()){
			$info=$r;
			
		}else{
			showMsg("参数错误");
			exit;
		}
		//上一篇  
		$front=$db->field("id,title")->where(array('id'=>array('gt',$id),"checkinfo"=>0,"pid"=>$info['pid']))->order('id asc')->limit('1')->find();  
		$this->assign('front',$front);  
		//下一篇  
		$after=$db->field("id,title")->where(array('id'=>array('lt',$id),"checkinfo"=>0,"pid"=>$info['pid']))->order('id desc')->limit('1')->find();  
		$this->assign('after',$after);
		
		$this->assign("info",$info);
		$this->display();
	}
}

?>